#!/bin/bash

echo "************************ Config Proxy ************************"
echo "*********************** Config Env Var ***********************"
export ANDROID_NDK=/home/greatpan/software/android-ndk-r20b

echo "********************** Build CMakeLists **********************"
set -e

function build_demo() {
    rm -rf build
    mkdir -p build
    cd ./build

    cmake .. \
          -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
          -DANDROID_NDK=$ANDROID_NDK            \
          -DCMAKE_BUILD_TYPE=Release            \
          -DANDROID_ABI="arm64-v8a"             \
          -DANDROID_STL=c++_static              \
          -DANDROID_NATIVE_API_LEVEL=android-29 \
          -G "Unix Makefiles"                   \
          -DANDROID_TOOLCHAIN=clang
    
    make -j8 OpenCLDemo
}

build_demo
